<?php

include('../includes/smarty.php');
include_once('../config.php');

$SEEKER = new Seeker();

if(empty($_POST))
{
	$smarty->assign('title', 'Signup');
	$smarty->assign('path', $site);
	$smarty->assign('states', get_state_select());
	$smarty->assign('zipREX', 		$regex_zip);
	$smarty->assign('phoneREX', 	$regex_phone);
	$smarty->assign('emailREX', 	$regex_email);	
	$smarty->assign('leftCol', 'main/newsFeed.tpl');
	$smarty->assign('mainCol', 'main/seekerSignup.tpl');
	$smarty->assign('rightCol', 'main/signin.tpl');
	$smarty->assign('success', '');
	
	$smarty->display('index.tpl');
}
else
{	
	$username = $_POST["username"];
    $email = $_POST["email"];
    $prefix = $_POST['prefix'];
    $firstname = $_POST['firstname'];
    $lastname = $_POST['lastname'];
    $suffix = $_POST['suffix'];
    $address_num = $_POST['address_num'];
    $address_st_name = $_POST['address_st_name'];
    $city = $_POST['city'];
    $state = $_POST['state'];
    $zip = $_POST['zip'];
    $gender = $_POST['gender'];
    $phone_home = $_POST['phone_home'];
    $password = $_POST['newpass'];
    $confirm_password = $_POST['confirmnewpass'];
    $date_registered = date("m.d.y");
	
	//////////////
	////  	CHECK FOR THE USERNAME IN DATABASE
	////	CHECK FOR THE PASSWORDS TO MATCH
	//////////////
	
	$SEEKER->add_seeker($username, $email, $prefix, $firstname, $lastname, $suffix, $address_num, $address_st_name, $city, $state, $zip, $gender, $phone_home, $password);
	
	$smarty->assign('title', 'Signup');
	$smarty->assign('path', $site);
	$smarty->assign('states', get_state_select());
	$smarty->assign('zipREX', 		$regex_zip);
	$smarty->assign('phoneREX', 	$regex_phone);
	$smarty->assign('emailREX', 	$regex_email);	
	$smarty->assign('leftCol', 'main/newsFeed.tpl');
	$smarty->assign('mainCol', 'main/seekerSignup.tpl');
	$smarty->assign('rightCol', 'main/signin.tpl');
	$smarty->assign('success', 'Your account has been successfully created.');
	
	$smarty->display('index.tpl');
	
}
?>